<?php 
class ContentController extends CommonController{
	private $model;
	public function __init(){
		parent::__init();
		$this->model=K('Comment');
	}
	public function index(){
		$aid = Q('get.aid',0,'intval');
		//浏览次数加1
		K('Article')->inc('click','aid=' . $aid, 1);
		//获得当前文章的数据
    		$data = M()->join('__article__ a JOIN __article_data__ ad ON a.aid=ad.article_aid JOIN __category__ c ON a.category_cid=c.cid')->where("aid={$aid}")->find();
		$data['total'] = M('comment')->where("article_aid={$aid}")->count();
		$this->assign('hdcms',$data);
		$this->dis('content.html');
	}
	public function total(){
		if(IS_POST){
			if(!$this->model->addData()) $this->error($this->model->error);
			$this->success('评论成功',U('index/index'));
			
		}
	}
}



 ?>